﻿// Copyright (c) 2007-2021 西安交通信息投资营运有限公司 版权所有
// 作者:吕艳阳

using System.Collections.Generic;
using System.Threading.Tasks;
using XCI.Core;

namespace XCI.Setting
{
    /// <summary>
    /// 配置存储接口
    /// </summary>
    public interface ISettingStore
    {
        /// <summary>
        /// 加载配置
        /// </summary>
        /// <param name="target">配置目标</param>
        /// <param name="id">配置标识</param>
        /// <param name="name">配置名称</param>
        Task LoadAsync(ISettingSerializer target, string id, string name);

        /// <summary>
        /// 保存配置
        /// </summary>
        /// <param name="target">配置目标</param>
        /// <param name="id">配置标识</param>
        /// <param name="name">配置名称</param>
        Task SaveAsync(ISettingSerializer target, string id, string name);

        /// <summary>
        /// 复制配置
        /// </summary>
        /// <param name="id">配置标识</param>
        /// <param name="sourceName">源名称</param>
        /// <param name="destName">目标名称</param>
        Task CopyAsync(string id, string sourceName, string destName);

        /// <summary>
        /// 下载配置
        /// </summary>
        /// <param name="id">配置标识</param>
        /// <param name="name">配置名称</param>
        Task DownloadAsync(string id, string name);

        /// <summary>
        /// 创建服务器文件
        /// </summary>
        /// <param name="id">配置标识</param>
        /// <param name="name">配置名称</param>
        ServerFile CrreateServerFile(string id, string name);

        /// <summary>
        /// 删除配置
        /// </summary>
        /// <param name="id">配置标识</param>
        /// <param name="name">配置名称</param>
        Task DeleteAsync(string id, string name);

        /// <summary>
        /// 查询配置名称集合
        /// </summary>
        /// <param name="id">配置标识</param>
        Task<IList<string>> ListAsync(string id);
    }
}